package com.wxy.demo.jsoup;

import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

@Slf4j
public class Main {
    public static void main(String[] args) throws IOException {
        Document document = Jsoup.parse(new File("/Users/wangxiaoyuan/Desktop/myworkspace/工作文档/favorites_2024_8_28.html"));
        Elements elements = document.select("A");
        elements.forEach(element -> {
            String href = element.attr("href");
            String name = element.text();
            log.info("[{}]({})",name,href);
        });
    }
}
